<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"   %>
<%@ include file="/common/taglibs.jsp" %>

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <%@ include file="/common/res-select2.jsp" %>
</head>
<body>
<div class="row">
    <div class="col-md-12">
        <form  method="post" id="inputForm" name="inputForm" class="form-horizontal" style="padding:5px 20px 0 0"  role="form">
            <div class="form-group">
                <label class="col-md-2 col-xs-2 control-label" for="userName">姓名<i  class="red">*</i></label>
                <div class="col-md-4 col-xs-4"  >
                    <input class="form-control"  name="userName"   id="userName"  type="text"  value="" placeholder="输入姓名">
                </div>
                <label class="col-md-2 col-xs-2 control-label" for="phoneNo">手机号码<i  class="red">*</i></label>
                <div class="col-md-4 col-xs-4"  >
                    <input class="form-control"  name="phoneNo"   id="phoneNo"  type="text"  value=""    placeholder="输入手机号码">
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-2 col-xs-2 control-label" for="idNumber">身份证号<i  class="red">*</i></label>
                <div class="col-md-4 col-xs-4"  >
                    <input class="form-control"  name="idNumber"    id="idNumber"  type="text"  value="" placeholder="输入身份证号">
                </div>
                <label class="col-md-2 col-xs-2 control-label" for="sex">性别</label>
                <div class="col-md-4 col-xs-4" >
                    <select id="sex" name="sex" class="form-control" >
                        <option value ="1" selected="selected">男</option>
                        <option value ="2">女</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-2 col-xs-2 control-label" for="address">地址</label>
                <div class="col-md-10 col-xs-10"  >
                    <input class="form-control"  name="address"    id="address"  type="text"  value="" placeholder="输入地址">
                </div>
            </div>
            <div class="form-group">
                <label class="col-md-2 col-xs-2 control-label" for="remark">备注</label>
                <div class="col-md-10 col-xs-10"  >
                    <input class="form-control"  name="remark"    id="remark"  type="text"  value="" placeholder="输入备注">
                </div>
            </div>
        </form>

    </div>
    <!--/.col-md-12-->
</div>
<!--/.row-->
<script>
    $(function () {
        var $inputForm = $('#inputForm');

        //ajax提交表单配置.
        var ajaxSubmitOption = {
            beforeSubmit: function () {
                //mask form,防止多次提交
                $inputForm.block()
            },
            success: function (resp, statusText) {
                $inputForm.unblock()
                window.refreshParentDataGrid();
                bootbox.hideAll();
                P.messager({content:resp.msg,type:resp.success==true?'success':'error'}) ;
            },
            url: P.ctx +  '/op/washer/update?',
            type: 'post',
            dataType: 'json'
        };

        //jquery validate 验证表单
        $inputForm.validate({
            submitHandler: function (form) {
                //验证成功之后使用jquery form提交表单.
                $(form).ajaxSubmit(ajaxSubmitOption);
            },
            rules: {
                userName: {
                    required: true,
                    maxlength: 50
                },
                phoneNo: {
                    required: true,
                    isMobile: true,
                    maxlength: 50
                },
                idNumber: {
                    required: true,
                    maxlength: 50
                },
                sortNum: {
                    digits: true
                }
            }, messages: {  //自定义提示消息.

            }
        }); //end validate


    });//Dom ready
</script>
</body>
</html>